from django.db import models


# Create your models here.
class Person(models.Model):
    name = models.CharField(max_length=16)
    sex = models.BooleanField(default=False)


class IDCard(models.Model):
    num = models.CharField(max_length=18, unique=True)
    person_id = models.OneToOneField(Person, null=True, blank=True, on_delete=models.CASCADE)

# --------------------
class Customer(models.Model):
    name = models.CharField(max_length=16)


class Goods(models.Model):
    name = models.CharField(max_length=16)
    customer = models.ManyToManyField(Customer)

# -000---------------------------
class Animal(models.Model):
    name = models.CharField(max_length=16)

    class Meta:
        abstract = True


class Cat(Animal):
    eat = models.CharField(max_length=32)


class Dog(Animal):
    legs = models.IntegerField(default=4)
